#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <ctime>

#define N 10
#define M 10

using namespace std; 

int obstacle[N][M]; 
int visited[N][M]; 

int n, m, t; 
int sx, sy, fx, fy; 
int res; 

int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; 

void dfs(int x, int y)
{
	visited[x][y] = 1; 

	if (x==fx && y==fy) {
		res++; 
		visited[x][y] = 0; 
		return; 
	}
	
	for (int i=0; i<4; i++) {
		int nx, ny; 
		nx = x + dir[i][0]; 
		ny = y + dir[i][1]; 
		if (nx<1 || nx>n || ny<1 || ny>m) 
			continue; 
		if (obstacle[nx][ny])
			continue; 
		if (visited[nx][ny])
			continue; 
		dfs(nx, ny); 
	}
	visited[x][y] = 0; 
}

int main()
{
	//freopen("p1605.in", "r", stdin); 
	cin>>n>>m>>t; 
	cin>>sx>>sy>>fx>>fy; 
	for (int i=0; i<t; i++) {
		int x, y; 
		cin>>x>>y;
		obstacle[x][y] = 1; 
	}
	dfs(sx, sy); 
	cout<<res<<endl; 
	return 0; 
}


